Load libraries

## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.4     ✓ dplyr   1.0.7
## ✓ tidyr   1.1.3     ✓ stringr 1.4.0
## ✓ readr   2.0.1     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
## Loading required package: viridisLite
## 
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
## 
##     between, first, last
## The following object is masked from 'package:purrr':
## 
##     transpose
#setwd("../Induction_system/Facs/Data analysis/Script")

Load data

#All data is in csv format in the “../data/2021-08-27_at_08-43-55am” folder

filenames = list.files(path = "../data/FACS_2021_09_09_CSV/Sample Group - 1 - Gate A/",full.names = T)


# Extract plate position from filename
sample_name = filenames %>% gsub("_Data Source - 1_A.csv","",.) %>% gsub("le_Group_1_","",.) %>% gsub(".*am.","",.)


# Loop through and merge all files into a big tibble
tbl = tibble()
for (i in 1:length(filenames)) {
  tbl_file = fread(filenames[i]) %>% mutate(POS = sample_name[i])
  tbl = rbind(tbl,tbl_file)
}

rm(tbl_file)

#Extraion of compensated data

filenames_comp = list.files(path = "../data/FACS_2021_09_09_CSV/Compensation Panel/",full.names = T)

# Extract plate position from filename
sample_name_comp = filenames_comp %>% gsub("_Data Source - 1_A.csv","",.) %>% gsub("le_Group_1_Compensation Panel_","",.) %>% gsub("EGFP_EGFP_A.csv","pGFP",.) %>% gsub("miRFP670_miRFP670_A.csv","pRFP",.) %>% gsub("Pacific Blue_Pacific Blue_A.csv","pBFP",.) %>% gsub("Negative Control_Negative Control_A.csv","pCENPK",.) %>% gsub(".*am.","",.)

# Loop through and merge all files from compensated into a big tibble
tbl_comp = tibble()
for (i in 1:length(filenames_comp)) {
  tbl_file_comp = fread(filenames_comp[i]) %>% mutate(POS = sample_name_comp[i])
  tbl_comp = rbind(tbl_comp,tbl_file_comp)
}

rm(tbl_file_comp)

Pre-procesing

#Replacement of hypgen (-) in columns & removal of defected index column

names(tbl) <- gsub("\\-",".", names(tbl))
names(tbl) <- gsub("\\.A.Compensated","", names(tbl))
names(tbl) <- gsub("\\Pacific Blue","BFP", names(tbl))
tbl$Index = NULL

glimpse(tbl)
## Rows: 805,085
## Columns: 9
## $ TIME     <dbl> 0.0000000000, 0.0006514286, 0.0008228571, 0.0013028570, 0.002…
## $ FSC.A    <dbl> 412479.8, 451923.9, 413993.8, 335756.6, 413562.6, 403134.8, 2…
## $ FSC.H    <dbl> 286600.2, 311926.7, 318567.2, 241114.7, 282876.2, 246048.3, 1…
## $ FSC.W    <int> 315, 314, 303, 288, 310, 319, 243, 277, 254, 290, 325, 272, 3…
## $ BSC.A    <dbl> 416602.2, 406967.0, 391401.6, 236016.6, 400477.4, 489543.5, 1…
## $ BFP      <dbl> -252.0389000, -797.4771000, -495.7184000, -13.1588000, -321.6…
## $ EGFP     <dbl> 569.9741, 394.6888, 271.0912, 170.9802, 389.3646, 672.5525, 4…
## $ miRFP670 <dbl> 9259.660, 17388.250, 11075.980, 4165.408, 9231.049, 27801.610…
## $ POS      <chr> "Cup_500", "Cup_500", "Cup_500", "Cup_500", "Cup_500", "Cup_5…

#Hypen replacemnt and name changing

names(tbl_comp) <- gsub("\\-",".", names(tbl_comp)) 
names(tbl_comp) <- gsub("\\Pacific Blue.A","BFP", names(tbl_comp)) 
names(tbl_comp) <- gsub("\\EGFP.A","EGFP", names(tbl_comp)) 
names(tbl_comp) <- gsub("\\miRFP670.A","miRFP670", names(tbl_comp)) 

head(tbl_comp)
##            TIME    FSC.A    FSC.H    BSC.A    BSC.H       BFP Pacific Blue.H
## 1: 0.0000000000 250295.5 226971.4 185710.7 149791.0 623.97500        1406.72
## 2: 0.0003885714 396567.4 281930.9 333183.9 190849.1 926.52400        1535.52
## 3: 0.0053828570 298409.3 222418.6 270935.5 184513.3 705.49300        1305.92
## 4: 0.0057600000 259285.1 223678.6 196818.6 135167.2 -16.21263        1230.88
## 5: 0.0067771430 175036.8 136286.1 205532.6 142713.8 349.11840        1118.88
## 6: 0.0068914280 407149.9 284247.0 335362.9 183232.0 352.24830        1604.96
##          EGFP   EGFP.H  miRFP670 miRFP670.H  POS
## 1:   180.8407   377.44 192.91620     439.04 pGFP
## 2:   335.5266   362.88 129.08370     301.28 pGFP
## 3:   471.2275   445.76 163.96740     445.76 pGFP
## 4: 15331.7600 15573.60 293.43010     730.24 pGFP
## 5:   379.7134   469.28 375.61960     395.36 pGFP
## 6:   330.7506   572.32  66.79992     266.56 pGFP

Filter out cells with negative intensity and log transform

tbl =
  tbl %>%
  filter(EGFP > 0) %>%
  mutate(log_EGFP = log10(EGFP+1)) %>%
  filter(miRFP670 > 0) %>% 
  mutate(log_miRFP670 = log10(miRFP670+1)) %>%
  filter(BFP > 0) %>%
  mutate(log_BFP = log10(BFP+1))
  
head(tbl)
##           TIME    FSC.A    FSC.H FSC.W    BSC.A         BFP     EGFP miRFP670
## 1: 0.004114286 301259.0 223201.4   277 283638.4 265.6477000 240.9676 1302.427
## 2: 0.005257143 283938.8 268095.5   254 166749.9  78.7960400 270.1115 2841.754
## 3: 0.007451429 279311.8 224771.7   265 237945.1   0.7901272 193.7543 6821.914
## 4: 0.014422860 343853.7 228942.6   293 332054.0  37.0436700 585.3580 3921.094
## 5: 0.015554290 318554.7 280707.8   265 242094.0 111.2441000 304.3398 2294.979
## 6: 0.017085710 260285.7 203609.3   261 196030.8 202.8584000 196.0150 4978.650
##        POS log_EGFP log_miRFP670   log_BFP
## 1: Cup_500 2.383757     3.115087 2.4259378
## 2: Cup_500 2.433148     3.453739 1.9019813
## 3: Cup_500 2.289487     3.833970 0.2528839
## 4: Cup_500 2.768163     3.593518 1.5802824
## 5: Cup_500 2.484783     3.360968 2.0501635
## 6: Cup_500 2.294499     3.697199 2.3093286

Filter out cells with negative intensity and log transform ofr comp

tbl_comp =
  tbl_comp %>%
  filter(EGFP > 0) %>%
  mutate(log_EGFP = log10(EGFP+1)) %>%
  filter(miRFP670 > 0) %>% 
  mutate(log_miRFP670 = log10(miRFP670+1)) %>%
  filter(BFP > 0) %>%
  mutate(log_BFP = log10(BFP+1))
  
head(tbl_comp)
##            TIME    FSC.A    FSC.H    BSC.A    BSC.H      BFP Pacific Blue.H
## 1: 0.0000000000 250295.5 226971.4 185710.7 149791.0 623.9750        1406.72
## 2: 0.0003885714 396567.4 281930.9 333183.9 190849.1 926.5240        1535.52
## 3: 0.0053828570 298409.3 222418.6 270935.5 184513.3 705.4930        1305.92
## 4: 0.0067771430 175036.8 136286.1 205532.6 142713.8 349.1184        1118.88
## 5: 0.0068914280 407149.9 284247.0 335362.9 183232.0 352.2483        1604.96
## 6: 0.0070057140 403275.3 252297.9 448210.6 242881.0 766.9320        1845.76
##        EGFP EGFP.H  miRFP670 miRFP670.H  POS log_EGFP log_miRFP670  log_BFP
## 1: 180.8407 377.44 192.91620     439.04 pGFP 2.259691     2.287614 2.795863
## 2: 335.5266 362.88 129.08370     301.28 pGFP 2.527019     2.114223 2.967325
## 3: 471.2275 445.76 163.96740     445.76 pGFP 2.674151     2.217398 2.849108
## 4: 379.7134 469.28 375.61960     395.36 pGFP 2.580598     2.575903 2.544215
## 5: 330.7506 572.32  66.79992     266.56 pGFP 2.520812     1.831229 2.548080
## 6: 359.2337 433.44 862.64830     760.48 pGFP 2.556584     2.936337 2.885323

#Add index for cell

tbl <- tbl %>% mutate(cell_id = 1:nrow(tbl))
tbl_comp <- tbl_comp %>% mutate(cell_id = 1:nrow(tbl_comp))

#Convert into tidy tibble and add channel info

tbl_tidy =
  tbl %>% 
  pivot_longer(-c(POS,TIME,cell_id),names_to = "CHANNEL",values_to = "INTENSITY") 
  #mutate(SCALE = ifelse(grepl("Lin",CHANNEL),"lin","log")) %>% 
  
glimpse(tbl_tidy)
## Rows: 5,421,310
## Columns: 5
## $ TIME      <dbl> 0.004114286, 0.004114286, 0.004114286, 0.004114286, 0.004114…
## $ POS       <chr> "Cup_500", "Cup_500", "Cup_500", "Cup_500", "Cup_500", "Cup_…
## $ cell_id   <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …
## $ CHANNEL   <chr> "FSC.A", "FSC.H", "FSC.W", "BSC.A", "BFP", "EGFP", "miRFP670…
## $ INTENSITY <dbl> 3.012590e+05, 2.232014e+05, 2.770000e+02, 2.836384e+05, 2.65…

#Convert into tidy tibble and add channel info

tbl_tidy_comp =
  tbl_comp %>% 
  pivot_longer(-c(POS,TIME,cell_id),names_to = "CHANNEL",values_to = "INTENSITY") 
  #mutate(SCALE = ifelse(grepl("Lin",CHANNEL),"lin","log")) %>% 
  
glimpse(tbl_tidy_comp)
## Rows: 1,164,605
## Columns: 5
## $ TIME      <dbl> 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.00…
## $ POS       <chr> "pGFP", "pGFP", "pGFP", "pGFP", "pGFP", "pGFP", "pGFP", "pGF…
## $ cell_id   <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, …
## $ CHANNEL   <chr> "FSC.A", "FSC.H", "BSC.A", "BSC.H", "BFP", "Pacific Blue.H",…
## $ INTENSITY <dbl> 2.502955e+05, 2.269714e+05, 1.857107e+05, 1.497910e+05, 6.23…

#Format meta data

tbl_meta = 
  fread(file = "../data/plate_map.csv") %>% 
  mutate(DOSE = as.character(DOSE)) %>% 
  mutate(DOSE_1 = as.character(DOSE_1)) %>% 
  mutate(DOSE_2 = as.character(DOSE_2)) %>%
  mutate(DOSE_3 = as.character(DOSE_3))

#Format meta data

tbl_meta_comp = 
  fread(file = "../data/plate_map2.csv") %>% 
  mutate(DOSE = as.character(DOSE)) %>% 
  mutate(DOSE_1 = as.character(DOSE_1)) %>% 
  mutate(DOSE_2 = as.character(DOSE_2)) %>%
  mutate(DOSE_3 = as.character(DOSE_3))

#Merge meta data with FACS meta data

tbl_tidy =
  tbl_tidy %>% 
  full_join(tbl_meta,by = "POS")

head(tbl_tidy)
## # A tibble: 6 × 15
##      TIME POS     cell_id CHANNEL INTENSITY CASE_CTRL INDUCER_1 DOSE_1 INDUCER_2
##     <dbl> <chr>     <int> <chr>       <dbl> <chr>     <chr>     <chr>  <chr>    
## 1 0.00411 Cup_500       1 FSC.A     301259  CASE      CUP       500    none     
## 2 0.00411 Cup_500       1 FSC.H     223201. CASE      CUP       500    none     
## 3 0.00411 Cup_500       1 FSC.W        277  CASE      CUP       500    none     
## 4 0.00411 Cup_500       1 BSC.A     283638. CASE      CUP       500    none     
## 5 0.00411 Cup_500       1 BFP          266. CASE      CUP       500    none     
## 6 0.00411 Cup_500       1 EGFP         241. CASE      CUP       500    none     
## # … with 6 more variables: DOSE_2 <chr>, INDUCER_3 <chr>, DOSE_3 <chr>,
## #   STRAIN <chr>, DOSE <chr>, NUM.IND <int>

#Merge meta data with FACS meta data

tbl_tidy_comp =
  tbl_tidy_comp %>% 
  full_join(tbl_meta_comp,by = "POS")

head(tbl_tidy_comp)
## # A tibble: 6 × 15
##    TIME POS   cell_id CHANNEL        INTENSITY CASE_CTRL INDUCER_1 DOSE_1 INDUCER_2
##   <dbl> <chr>   <int> <chr>              <dbl> <chr>     <chr>     <chr>  <chr>    
## 1     0 pGFP        1 FSC.A            250296. CTRL      EST       0.01   none     
## 2     0 pGFP        1 FSC.H            226971. CTRL      EST       0.01   none     
## 3     0 pGFP        1 BSC.A            185711. CTRL      EST       0.01   none     
## 4     0 pGFP        1 BSC.H            149791  CTRL      EST       0.01   none     
## 5     0 pGFP        1 BFP                 624. CTRL      EST       0.01   none     
## 6     0 pGFP        1 Pacific Blue.H     1407. CTRL      EST       0.01   none     
## # … with 6 more variables: DOSE_2 <chr>, INDUCER_3 <chr>, DOSE_3 <chr>,
## #   STRAIN <chr>, DOSE <chr>, NUM.IND <int>

#Merge tbl and tbl_comp

tbl_tidy_merge =
  tbl_tidy %>% 
  full_join(tbl_tidy_comp)
## Joining, by = c("TIME", "POS", "cell_id", "CHANNEL", "INTENSITY", "CASE_CTRL", "INDUCER_1", "DOSE_1", "INDUCER_2", "DOSE_2", "INDUCER_3", "DOSE_3", "STRAIN", "DOSE", "NUM.IND")
head(tbl_tidy_merge)
## # A tibble: 6 × 15
##      TIME POS     cell_id CHANNEL INTENSITY CASE_CTRL INDUCER_1 DOSE_1 INDUCER_2
##     <dbl> <chr>     <int> <chr>       <dbl> <chr>     <chr>     <chr>  <chr>    
## 1 0.00411 Cup_500       1 FSC.A     301259  CASE      CUP       500    none     
## 2 0.00411 Cup_500       1 FSC.H     223201. CASE      CUP       500    none     
## 3 0.00411 Cup_500       1 FSC.W        277  CASE      CUP       500    none     
## 4 0.00411 Cup_500       1 BSC.A     283638. CASE      CUP       500    none     
## 5 0.00411 Cup_500       1 BFP          266. CASE      CUP       500    none     
## 6 0.00411 Cup_500       1 EGFP         241. CASE      CUP       500    none     
## # … with 6 more variables: DOSE_2 <chr>, INDUCER_3 <chr>, DOSE_3 <chr>,
## #   STRAIN <chr>, DOSE <chr>, NUM.IND <int>
tbl_tidy = tbl_tidy_merge

#Matrix with flipped columns

tbl_red_green_blue =

tbl_tidy %>% 
  filter(CHANNEL %in% c("log_EGFP", "log_miRFP670","log_BFP")) %>% 
  pivot_wider(names_from = CHANNEL, values_from = INTENSITY)

glimpse(tbl_red_green_blue)
## Rows: 631,716
## Columns: 16
## $ TIME         <dbl> 0.004114286, 0.005257143, 0.007451429, 0.014422860, 0.015…
## $ POS          <chr> "Cup_500", "Cup_500", "Cup_500", "Cup_500", "Cup_500", "C…
## $ cell_id      <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17…
## $ CASE_CTRL    <chr> "CASE", "CASE", "CASE", "CASE", "CASE", "CASE", "CASE", "…
## $ INDUCER_1    <chr> "CUP", "CUP", "CUP", "CUP", "CUP", "CUP", "CUP", "CUP", "…
## $ DOSE_1       <chr> "500", "500", "500", "500", "500", "500", "500", "500", "…
## $ INDUCER_2    <chr> "none", "none", "none", "none", "none", "none", "none", "…
## $ DOSE_2       <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0…
## $ INDUCER_3    <chr> "none", "none", "none", "none", "none", "none", "none", "…
## $ DOSE_3       <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0…
## $ STRAIN       <chr> "Cup", "Cup", "Cup", "Cup", "Cup", "Cup", "Cup", "Cup", "…
## $ DOSE         <chr> "500", "500", "500", "500", "500", "500", "500", "500", "…
## $ NUM.IND      <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ log_EGFP     <dbl> 2.383757, 2.433148, 2.289487, 2.768163, 2.484783, 2.29449…
## $ log_miRFP670 <dbl> 3.115087, 3.453739, 3.833970, 3.593518, 3.360968, 3.69719…
## $ log_BFP      <dbl> 2.4259378, 1.9019813, 0.2528839, 1.5802824, 2.0501635, 2.…

Single plasmid TETON

#TetON violin plot, log scale

p_violoin_tet_BFP =
tbl_tidy %>% 
  filter(STRAIN %in% c("Tet","CENPK")) %>% 
  filter(NUM.IND %in% c("1")) %>% 
  filter(CHANNEL %in% c("log_BFP")) %>% 
  ggplot(aes(x = DOSE_1,y = INTENSITY,group = DOSE_1, fill = DOSE_1)) +
  geom_violin(alpha = 0.5, adjust = 0.0001,draw_quantiles = 0.5) +
  facet_wrap(vars(CASE_CTRL),ncol = 10) +
  scale_color_viridis(name = "DOSE (µM)",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM)", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  theme_bw() +
  stat_compare_means(ref.group = "0",label = "p.signif", method = "wilcox.test") +
  ggtitle("Violin plot of BFP - Tetracyclin plasmid") +
  xlab("Tetracyclin (µM)") +
  ylab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_violoin_tet_BFP
## Warning: Computation failed in `stat_compare_means()`:
## argument "x" is missing, with no default
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

#BFP expression depending of Tetracyclin conc.

p_density_tet_BFP_diff_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet")) %>% 
  ggplot(aes(log_BFP, color = DOSE_1, fill = DOSE_1)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  facet_wrap(vars(DOSE_1, INDUCER_1),nrow = 2) +
  scale_color_viridis(name = "DOSE (µM)",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM)",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  theme_bw() +
  ggtitle ("Density plots for BFP expression - Tetracyclin plasmid") +
  ylab("Density") + 
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_tet_BFP_diff_plot

#RFP expression depending of Tetracyclin conc.in ONE plot

p_density_tet_BFP_same_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet")) %>% 
  ggplot(aes(log_BFP, color = DOSE_1, fill = DOSE_1)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  
  scale_color_viridis(name = "DOSE (µM)",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM)",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  theme_bw() +
  ggtitle ("Density plots for BFP expression - Tetracyclin plasmid") +
  ylab("Density") + 
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_tet_BFP_same_plot

LINCOLN GFP expression depending of EST

p_density_tet_BFP_lincoln =
 tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet")) %>% 
  ggplot(lincoln_weather, mapping = aes(x = log_BFP, y = DOSE_1, fill = stat(x))) +
  geom_density_ridges_gradient(scale = 3, rel_min_height = 0.01) +
  scale_fill_viridis_c(name = "Expression", option = "magma") +
  theme_bw() +
  ggtitle("Density plots for BFP expression - Tetracyclin plasmid") +
  ylab("DOSE (µM)") +
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5,face = "bold", size = 15))

p_density_tet_BFP_lincoln
## Picking joint bandwidth of 0.0883

Double plasmid Tetracycline & Estradiol

#BFP & GFP violin expression

p_violin_Tet.est_BFP_GFP =

tbl_tidy %>% 
  filter(STRAIN %in% c("Tet.Est")) %>%
  filter(NUM.IND %in% c("2")) %>% 
  filter(CHANNEL %in% c("log_BFP","log_EGFP")) %>% 
  
  ggplot(aes(x = DOSE,y = INTENSITY,group = DOSE, fill = DOSE)) +
  geom_violin(alpha = 0.5, adjust = 0.0001,draw_quantiles = 0.5) +
  
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  stat_compare_means(ref.group = "0/0",label = "p.signif", method = "wilcox.test") +
  ggtitle("Violin plot of BFP & GFP intensity -
Tetracyclin & Estradiol plasmids") +
  facet_wrap(vars(CHANNEL, STRAIN)) +
  xlab("Tetracyclin and Estradiol (µM)") +
  ylab("Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_violin_Tet.est_BFP_GFP
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

#BFP expression depending of TET conc.

p_density_Tet.est_BFP_all_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Est")) %>% 
  #mutate(DOSE_1 = factor(DOSE_1,levels = c("0","100","500","1000"),ordered = TRUE)) %>%
  ggplot(aes(log_BFP, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  facet_wrap(vars(DOSE),nrow = 1) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for BFP expression -
Tetracyclin & Estradiol plasmids") +
  ylab("Density") + 
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.est_BFP_all_plot 

BFP expression depending of Tet conc.

p_density_Tet.est_BFP_same_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Est")) %>% 
  #mutate(DOSE_1 = factor(DOSE_1,levels = c("0","100","500","1000"),ordered = TRUE)) %>%
  ggplot(aes(log_BFP, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  #facet_wrap(vars(DOSE),nrow = 3) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for BFP expression -
Tetracyclin & Estradiol plasmids") +
  ylab("Density") + 
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.est_BFP_same_plot 

LINCOLN BFP expression depending of

p_density_Tet.est_BFP_lincoln =
 tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Est")) %>% 
  ggplot(lincoln_weather, mapping = aes(x = log_BFP, y = DOSE, fill = stat(x))) +
  geom_density_ridges_gradient(alpha = 0.1, adjust = 0.0001, scale = 3, rel_min_height = 0.01)  +
  scale_fill_viridis_c(name = "Expression", option = "magma") +
  theme_bw() +
  ggtitle("Density plots for BFP expression -
Tetracyclin & Estradiol plasmids") +
  ylab("DOSE (µM)") +
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5,face = "bold", size = 15))
## Warning: Ignoring unknown parameters: adjust
p_density_Tet.est_BFP_lincoln
## Picking joint bandwidth of 0.0931

GFP

#GFP expression depending of EST conc.

p_density_Tet.est_GFP_all_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Est")) %>% 
  #mutate(DOSE_1 = factor(DOSE_1,levels = c("0","100","500","1000"),ordered = TRUE)) %>%
  ggplot(aes(log_EGFP, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  facet_wrap(vars(DOSE),nrow = 1) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for GFP expression -
Tetracyclin & Estradiol plasmids") +
  ylab("Density") + 
  xlab("GFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.est_GFP_all_plot 

GFP expression depending of EST conc.

p_density_Tet.est_GFP_same_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Est")) %>% 
  
  ggplot(aes(log_EGFP, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for GFP expression -
Tetracyclin & Estradiol plasmids") +
  ylab("Density") + 
  xlab("GFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.est_GFP_same_plot 

LINCOLN GFP expression depending of

p_density_Tet.est_GFP_lincoln =
 tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Est")) %>% 
  ggplot(lincoln_weather, mapping = aes(x = log_EGFP, y = DOSE, fill = stat(x))) +
  geom_density_ridges_gradient(alpha = 0.1, adjust = 0.0001, scale = 3, rel_min_height = 0.01)  +
  scale_fill_viridis_c(name = "Expression", option = "magma") +
  theme_bw() +
  ggtitle("Density plots for GFP expression -
Tetracyclin & Estradiol plasmids") +
  ylab("DOSE (µM)") +
  xlab("GFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5,face = "bold", size = 15))
## Warning: Ignoring unknown parameters: adjust
p_density_Tet.est_GFP_lincoln
## Picking joint bandwidth of 0.0357

Double plasmid Tetracycline & Copper

#BFP & RFP violin expression

p_violin_Tet.cup_BFP_RFP =

tbl_tidy %>% 
  filter(STRAIN %in% c("Tet.Cup")) %>%
  filter(NUM.IND %in% c("2")) %>% 
  filter(CHANNEL %in% c("log_BFP","log_miRFP670")) %>% 
  
  ggplot(aes(x = DOSE,y = INTENSITY,group = DOSE, fill = DOSE)) +
  geom_violin(alpha = 0.5, adjust = 0.0001,draw_quantiles = 0.5) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  stat_compare_means(ref.group = "0/0",label = "p.signif", method = "wilcox.test") +
  ggtitle("Violin plot of BFP & RFP intensity -
Tetracyclin & Copper plasmids") +
  facet_wrap(vars(CHANNEL, STRAIN)) +
  xlab("Tetracyclin and Copper (µM)") +
  ylab("Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_violin_Tet.cup_BFP_RFP
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

#BFP expression depending of Tet conc.

p_density_Tet.cup_BFP_all_plots =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup")) %>% 
  ggplot(aes(log_BFP, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  facet_wrap(vars(DOSE),nrow = 1) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for BFP expression -
Tetracyclin & Copper plasmids") +
  ylab("Density") + 
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.cup_BFP_all_plots 

BFP expression depending of Tet conc.

p_density_Tet.cup_BFP_same_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup")) %>% 
  #mutate(DOSE_1 = factor(DOSE_1,levels = c("0","100","500","1000"),ordered = TRUE)) %>%
  ggplot(aes(log_BFP, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  #facet_wrap(vars(DOSE),nrow = 3) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for BFP expression -
Tetracyclin & Copper plasmids") +
  ylab("Density") + 
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.cup_BFP_same_plot 

LINCOLN BFP expression depending of

p_density_Tet.cup_BFP_lincoln =
 tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup")) %>% 
  ggplot(lincoln_weather, mapping = aes(x = log_BFP, y = DOSE, fill = stat(x))) +
  geom_density_ridges_gradient(alpha = 0.1, adjust = 0.0001, scale = 3, rel_min_height = 0.01)  +
  scale_fill_viridis_c(name = "Expression", option = "magma") +
  theme_bw() +
  ggtitle("Density plots for BFP expression -
Tetracyclin & Copper plasmids") +
  ylab("DOSE (µM)") +
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5,face = "bold", size = 15))
## Warning: Ignoring unknown parameters: adjust
p_density_Tet.cup_BFP_lincoln
## Picking joint bandwidth of 0.0989

RFP

#RFP expression depending of CUP conc.

p_density_Tet.cup_RFP_all_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup")) %>% 

  ggplot(aes(log_miRFP670, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  facet_wrap(vars(DOSE),nrow = 1) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for RFP expression -
Tetracyclin & Copper plasmids") +
  ylab("Density") + 
  xlab("RFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.cup_RFP_all_plot 

GFP expression depending of Tet conc.

p_density_Tet.cup_RFP_same_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup")) %>% 
  
  ggplot(aes(log_miRFP670, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for RFP expression -
Tetracyclin & Copper plasmids") +
  ylab("Density") + 
  xlab("RFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.cup_RFP_same_plot 

LINCOLN GFP expression depending of

p_density_Tet.cup_RFP_lincoln =
 tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup")) %>% 
  ggplot(lincoln_weather, mapping = aes(x = log_miRFP670, y = DOSE, fill = stat(x))) +
  geom_density_ridges_gradient(alpha = 0.1, adjust = 0.0001, scale = 3, rel_min_height = 0.01)  +
  scale_fill_viridis_c(name = "Intesity (a.u.)", option = "magma") +
  theme_bw() +
  ggtitle("Density plots for RFP expression -
Tetracyclin & Copper plasmids") +
  ylab("DOSE (µM)") +
  xlab("RFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5,face = "bold", size = 15))
## Warning: Ignoring unknown parameters: adjust
p_density_Tet.cup_RFP_lincoln
## Picking joint bandwidth of 0.0438

(p_density_Tet.cup_RFP_same_plot + p_density_Tet.cup_RFP_lincoln)/(p_density_Tet.cup_RFP_same_plot + p_density_Tet.cup_RFP_lincoln)
## Picking joint bandwidth of 0.0438
## Picking joint bandwidth of 0.0438

p_density_Tet.cup_RFP_same_plot/p_density_Tet.cup_RFP_lincoln
## Picking joint bandwidth of 0.0438

Three plasmids ########3

#BFP & RFP & GFP violin expression

p_violin_Tet.cup.est =
  tbl_tidy %>% 
  filter(STRAIN %in% c("Tet.Cup.Est")) %>%
  filter(NUM.IND %in% c("3")) %>% 
  filter(CHANNEL %in% c("log_BFP","log_EGFP", "log_miRFP670")) %>% 
  mutate(DOSE = factor(DOSE, levels = c("0/0/0", "0.5/500/0.005", "1/500/0.01"))) %>% 
  ggplot(aes(x = DOSE,y = INTENSITY,group = DOSE, fill = DOSE)) +
  geom_violin(alpha = 0.5, adjust = 0.0001,draw_quantiles = 0.5) +
  scale_color_viridis(name = "DOSE (µM), \nTet/Cup/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), \nTet/Cup/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  theme_bw() +
  stat_compare_means(ref.group = "0/0/0",label = "p.signif",method = "wilcox.test") +
  ggtitle("Violin plot of BFP, GFP & RFP intensity - Tetracyclin & Copper plasmids") +
  facet_wrap(vars(CHANNEL)) +
  xlab("") +
  ylab("Intesity (a.u.)") +
  theme(aspect.ratio = 1, 
        plot.title = element_text(hjust = 0.5, face = "bold", size = 15),
        axis.text.x = element_text(angle = 45,hjust = 1))


p_violin_Tet.cup.est
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_violin_Tet.cup.est.png")
## Saving 12 x 5 in image
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

BFP

#BFP expression depending of Tet conc.

p_density_Tet.cup.est_BFP_all_plots =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup.Est")) %>% 
  mutate(DOSE = factor(DOSE, levels = c("0/0/0", "0.5/500/0.005", "1/500/0.01"))) %>% 
  ggplot(aes(log_BFP, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  facet_wrap(vars(DOSE),nrow = 1) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for BFP expression -
Tetracyclin, Estradiol & Copper plasmids") +
  ylab("Density") + 
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,
        plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.cup.est_BFP_all_plots 

#BFP expression depending of Tet conc.

p_density_Tet.cup.est_BFP_same_plots =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup.Est")) %>% 
  mutate(DOSE = factor(DOSE, levels = c("0/0/0", "0.5/500/0.005", "1/500/0.01"))) %>% 
  ggplot(aes(log_BFP, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  #facet_wrap(vars(DOSE),nrow = 1) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for BFP expression -
Tetracyclin, Estradiol & Copper plasmids") +
  ylab("Density") + 
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.cup.est_BFP_same_plots 

LINCOLN BFP expression depending of

p_density_Tet.cup.est_BFP_lincoln =
 tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup.Est")) %>% 
   mutate(DOSE = factor(DOSE, levels = c("0/0/0", "0.5/500/0.005", "1/500/0.01"))) %>% 
  ggplot(lincoln_weather, mapping = aes(x = log_BFP, y = DOSE, fill = stat(x))) +
  geom_density_ridges_gradient(alpha = 0.1, adjust = 0.0001, scale = 3, rel_min_height = 0.01)  +
  scale_fill_viridis_c(name = "Intesity (a.u.)", option = "magma") +
  theme_bw() +
  ggtitle("Density plots for BFP expression -
Tetracyclin, Estradiol & Copper plasmids") +
  ylab("DOSE (µM)") +
  xlab("BFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5,face = "bold", size = 15))
## Warning: Ignoring unknown parameters: adjust
p_density_Tet.cup.est_BFP_lincoln
## Picking joint bandwidth of 0.0988

RFP

#RFP expression depending of CUP conc.

p_density_Tet.cup.est_RFP_all_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup.Est")) %>% 
  mutate(DOSE = factor(DOSE, levels = c("0/0/0", "0.5/500/0.005", "1/500/0.01"))) %>% 
  ggplot(aes(log_miRFP670, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  facet_wrap(vars(DOSE),nrow = 1) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for RFP expression -
Tetracyclin, Estradiol & Copper plasmids") +
  ylab("Density") + 
  xlab("RFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.cup.est_RFP_all_plot 

RFP expression depending of Tet conc.

p_density_Tet.cup.est_RFP_same_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup.Est")) %>% 
  mutate(DOSE = factor(DOSE, levels = c("0/0/0", "0.5/500/0.005", "1/500/0.01"))) %>% 
  ggplot(aes(log_miRFP670, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for RFP expression -
Tetracyclin, Estradiol & Copper plasmids") +
  ylab("Density") + 
  xlab("RFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.cup.est_RFP_same_plot 

LINCOLN RFP expression depending of

p_density_Tet.cup.est_RFP_lincoln =
 tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup.Est")) %>% 
  mutate(DOSE = factor(DOSE, levels = c("0/0/0", "0.5/500/0.005", "1/500/0.01"))) %>% 
  ggplot(lincoln_weather, mapping = aes(x = log_miRFP670, y = DOSE, fill = stat(x))) +
  geom_density_ridges_gradient(alpha = 0.1, adjust = 0.0001, scale = 3, rel_min_height = 0.01)  +
  scale_fill_viridis_c(name = "Intesity (a.u.)", option = "magma") +
  theme_bw() +
  ggtitle("Density plots for RFP expression -
Tetracyclin, Estradiol & Copper plasmids") +
  ylab("DOSE (µM)") +
  xlab("RFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5,face = "bold", size = 15))
## Warning: Ignoring unknown parameters: adjust
p_density_Tet.cup.est_RFP_lincoln
## Picking joint bandwidth of 0.0356

GFP

#GFP expression depending of EST conc.

p_density_Tet.cup.est_GFP_all_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup.Est")) %>% 
  mutate(DOSE = factor(DOSE, levels = c("0/0/0", "0.5/500/0.005", "1/500/0.01"))) %>%
  ggplot(aes(log_EGFP, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  facet_wrap(vars(DOSE),nrow = 1) +
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for GFP expression -
Tetracyclin, Estradiol & Copper plasmids") +
  ylab("Density") + 
  xlab("GFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.cup.est_GFP_all_plot 

GFP expression depending of EST conc.

p_density_Tet.cup.est_GFP_same_plot =
  tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup.Est")) %>% 
  mutate(DOSE = factor(DOSE, levels = c("0/0/0", "0.5/500/0.005", "1/500/0.01"))) %>%
  ggplot(aes(log_EGFP, color = DOSE, fill = DOSE)) +
  geom_density(alpha = 0.5, adjust = 0.0001) +
  
  scale_color_viridis(name = "DOSE (µM), 
  Tet/Cup/Est",discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  scale_fill_viridis(name = "DOSE (µM), 
  Tet/Cup/Est", discrete = T,direction = -1, option = "A",begin = 0.2, end=0.8) +
  
  theme_bw() +
  ggtitle ("Density plots for GFP expression -
Tetracyclin, Estradiol & Copper plasmids") +
  ylab("Density") + 
  xlab("GFP Intesity (a.u.)") +
  theme(aspect.ratio = 1,plot.title = element_text(hjust = 0.5, face = "bold", size = 15))

p_density_Tet.cup.est_GFP_same_plot 

LINCOLN GFP expression depending of

p_density_Tet.cup.est_GFP_lincoln =
 tbl_red_green_blue %>% 
  filter(STRAIN == c("Tet.Cup.Est")) %>% 
  mutate(DOSE = factor(DOSE, levels = c("0/0/0", "0.5/500/0.005", "1/500/0.01"))) %>%
  ggplot(lincoln_weather, mapping = aes(x = log_EGFP, y = DOSE, fill = stat(x))) +
  geom_density_ridges_gradient(alpha = 0.1, adjust = 0.0001, scale = 3, rel_min_height = 0.01)  +
  scale_fill_viridis_c(name = "Intesity (a.u.)", option = "magma") +
  theme_bw() +
  ggtitle("Density plots for GFP expression -
Tetracyclin, Estradiol & Copper plasmids") +
  ylab("DOSE (µM)") +
  xlab("GFP Intesity (a.u.)") +
  theme(aspect.ratio = 1, plot.title = element_text(hjust = 0.5,face = "bold", size = 15))
## Warning: Ignoring unknown parameters: adjust
p_density_Tet.cup.est_GFP_lincoln
## Picking joint bandwidth of 0.0297

#Used for saving all of the plots to local computer! Need to be changed!

p_violoin_tet_BFP
## Warning: Computation failed in `stat_compare_means()`:
## argument "x" is missing, with no default
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="violoin_tet_BFP.png")
## Saving 7 x 5 in image
## Warning: Computation failed in `stat_compare_means()`:
## argument "x" is missing, with no default

## Warning: collapsing to unique 'x' values

## Warning: collapsing to unique 'x' values

## Warning: collapsing to unique 'x' values

## Warning: collapsing to unique 'x' values

## Warning: collapsing to unique 'x' values

## Warning: collapsing to unique 'x' values
p_density_tet_BFP_diff_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_tet_BFP_diff_plot.png")
## Saving 7 x 5 in image
p_density_tet_BFP_same_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_tet_BFP_same_plot.png")
## Saving 7 x 5 in image
p_density_tet_BFP_lincoln
## Picking joint bandwidth of 0.0883

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_tet_BFP_lincoln.png")
## Saving 7 x 5 in image
## Picking joint bandwidth of 0.0883
p_violin_Tet.est_BFP_GFP
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="violin_Tet.est_BFP_GFP.png")
## Saving 7 x 5 in image
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values
p_density_Tet.est_BFP_all_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.est_BFP_all_plot.png")
## Saving 7 x 5 in image
p_density_Tet.est_BFP_same_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.est_BFP_same_plot.png")
## Saving 7 x 5 in image
p_density_Tet.est_BFP_lincoln
## Picking joint bandwidth of 0.0931

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.est_BFP_lincoln.png")
## Saving 7 x 5 in image
## Picking joint bandwidth of 0.0931
p_density_Tet.est_GFP_all_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.est_GFP_all_plot.png")
## Saving 7 x 5 in image
p_density_Tet.est_GFP_same_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.est_GFP_same_plot.png")
## Saving 7 x 5 in image
p_density_Tet.est_GFP_lincoln
## Picking joint bandwidth of 0.0357

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.est_GFP_lincoln.png")
## Saving 7 x 5 in image
## Picking joint bandwidth of 0.0357
p_violin_Tet.cup_BFP_RFP
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="violin_Tet.cup_BFP_RFP.png")
## Saving 7 x 5 in image
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values
p_density_Tet.cup_BFP_all_plots

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup_BFP_all_plots.png")
## Saving 7 x 5 in image
p_density_Tet.cup_BFP_same_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup_BFP_same_plot.png")
## Saving 7 x 5 in image
p_density_Tet.cup_BFP_lincoln
## Picking joint bandwidth of 0.0989

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup_BFP_lincoln.png")
## Saving 7 x 5 in image
## Picking joint bandwidth of 0.0989
p_density_Tet.cup_RFP_all_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup_RFP_all_plot.png")
## Saving 7 x 5 in image
p_density_Tet.cup_RFP_same_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup_RFP_same_plot.png")
## Saving 7 x 5 in image
p_density_Tet.cup_RFP_lincoln
## Picking joint bandwidth of 0.0438

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup_RFP_lincoln.png")
## Saving 7 x 5 in image
## Picking joint bandwidth of 0.0438
p_violin_Tet.cup.est
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="violin_Tet.cup.est.png")
## Saving 7 x 5 in image
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values
p_density_Tet.cup.est_BFP_all_plots

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup.est_BFP_all_plots.png")
## Saving 7 x 5 in image
p_density_Tet.cup.est_BFP_same_plots

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup.est_BFP_same_plots.png")
## Saving 7 x 5 in image
p_density_Tet.cup.est_BFP_lincoln
## Picking joint bandwidth of 0.0988

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup.est_BFP_lincoln.png")
## Saving 7 x 5 in image
## Picking joint bandwidth of 0.0988
p_density_Tet.cup.est_RFP_all_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup.est_RFP_all_plot.png")
## Saving 7 x 5 in image
p_density_Tet.cup.est_RFP_same_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup.est_RFP_same_plot.png")
## Saving 7 x 5 in image
p_density_Tet.cup.est_RFP_lincoln
## Picking joint bandwidth of 0.0356

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup.est_RFP_lincoln.png")
## Saving 7 x 5 in image
## Picking joint bandwidth of 0.0356
p_density_Tet.cup.est_GFP_all_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup.est_GFP_all_plot.png")
## Saving 7 x 5 in image
p_density_Tet.cup.est_GFP_same_plot

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup.est_GFP_same_plot.png")
## Saving 7 x 5 in image
p_density_Tet.cup.est_GFP_lincoln
## Picking joint bandwidth of 0.0297

ggsave(path ="/Users/Edwin/Google Drive/CHALMERS/iGEM/WetLAB/All_plots/",filename ="density_Tet.cup.est_GFP_lincoln.png")
## Saving 7 x 5 in image
## Picking joint bandwidth of 0.0297